
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<html class="no-js">
<head>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>注册</title> 
  <link rel="stylesheet" href="${ctx }/mobile/css/amazeui.min.css">  
  <link rel="stylesheet" href="${ctx }/css/app.css">
  <link href="${ctx }/css/public.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="${ctx}/jquery-easyui-1.4.5/jquery.min.js"></script>
	<script type="text/javascript" src="${ctx}/jquery-easyui-1.4.5/jquery.easyui.min.js"></script>
  	<script type="text/javascript" src="${ctx }/js/public.js"></script>
</head>

<script>

	function submitRegisterForm() {
		var phone = document.getElementById("phone").value;
		var inputPwd = document.getElementById("passWord").value;
		var inputPwdAgain = document.getElementById("passwordAgain").value;
		var utel=document.getElementById("phone");
		var str=utel.value;
		var regPartton=/1[3-8]+\d{9}/;
		if(!str || str==null){
			ShowTip("手机号码不能为空！");
		}else if(!regPartton.test(str)){
			ShowTip("手机号码格式不正确！！");
		}else if(inputPwd.length <= 0){
			ShowTip("请输入密码！");
		}else if(inputPwdAgain.length <= 0){
			$.messager.alert("提示", "请输入验证密码！");
		}else if(inputPwd != inputPwdAgain){
			ShowTip("两次密码要一致！");
		}else if(/[^\x00-\xff]/g.test(inputPwd)){//验证密码是否含有汉字，虽然输入框的type为password，在键盘上敲不进汉字，但是可以通过复制汉字进去
			ShowTip("输入的密码不可以含有汉字！！");
		}else{
			$('#registerForm').form('submit', {
				url : '${ctx}/mobile/goregister',
				dataType : 'json',
				success : function(result) {
					var json = $.parseJSON(result);
					if (json.success == 0) {
						ShowTip("注册成功！去登录吧～");
						window.location.href = "${ctx}/mobile/goLogin";
					} else if (json.success == 1) {
						ShowTip("注册失败！请使用不同的用户名注册！");
						$('#registerForm').form('clear');
					} else {
						ShowTip(json.msg);
					}
				}
			});
		}
	}
	function back() {
		window.location.href = "${ctx}/mobile/goLogin";
	}
</script>
<body>
<div class="am-g">
	<!-- LOGO -->
	 <div class="am-u-sm-12 am-text-center myapp-login-top" >
	 	<div class="am-u-sm-12 am-text-center myapp-login-top" >
	 	 	<i class="am-icon-twitch myapp-login-top"></i>
	 	 </div>
	</div> 
	<!-- 登陆框 -->
	<div class="am-u-sm-11 am-u-sm-centered">
	<form id="registerForm" class="am-form" method="post" >
	  <fieldset class="myapp-login-form am-form-set">
		<div class="am-form-group am-form-icon">
			<i class="am-icon-user"></i>
			<input  type="text" id="phone" name="phone" class="myapp-login-input-text am-form-field" placeholder="请输入您的手机号码">
		</div>
	    <div class="am-form-group am-form-icon">
			<i class="am-icon-lock"></i>
			<input type="password"  id="passWord" name="passWord"  class="myapp-login-input-text am-form-field" placeholder="请输入密码">
		</div>
		<div class="am-form-group am-form-icon">
			<i class="am-icon-lock"></i>
			<input type="password" id="passwordAgain" name="passwordAgain"  class="myapp-login-input-text am-form-field" placeholder="请再一次输入重复密码"">
		</div>
	  </fieldset>
	 <div type="submit" class="myapp-login-form-submit am-btn am-btn-primary am-btn-block " onclick="submitRegisterForm()">注 册</div>
	</form>
	<div type="submit" class="myapp-login-form-submit am-btn am-btn-primary am-btn-block " onclick="back()">返 回</div>	  
	
	</div>

</div>
</body>
</html>